<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>水墨铺满动画</title>
</head>
<style>
:root {
  --height: 100px;
  --width: 200px;
}

* {
  margin: 0;
  padding: 0;
}

.wrapper {
  width:300px;    
  margin: 200px auto;
}
/* 第二步：开始写CSS样式 */
/* 首先，写好按钮的CSS样式 */
.button {
  position: relative;
  width: calc(0.8 * var(--width));
  height: calc(0.7 * var(--height));
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  /* overflow: hidden; */
  margin: 0 0.8rem;
  background: #666;
  border-radius: 10px;
}

/* 然后，写好按钮文字样式 */
.button span {
  color: #fff;
  font-size: 1rem;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bolder;
}

/* 写好按钮背景的样式 */
.button .back {
  position: absolute;
  width: 0;
  height: 0;
  border-radius: 50%;
  z-index: 5;
  transition: all 1.5s cubic-bezier(0.1, 0.22, 0.3, 1);
  left: -50%;
  top: -50%;
  background: #000;
}

/* 鼠标移入按钮放大背景高宽 */
.button:hover .back {
  width: calc(2 * var(--width));
  height: calc(2 * var(--height));
}
</style>
<body>
    <!-- 第一步：写好按钮布局，按钮分为文字和背景 -->
    <div class="wrapper">
        <div class="button"> 
            <span>前端学习</span>
            <div class="back"></div>
        </div>
    </div>
</body>
</html>